package cn.study.completableFutureTest.flow;


import cn.study.tools.SleepTools;

import java.util.concurrent.CompletableFuture;

/**
 * 类说明：
 */
/**
 * @Author     ：跟大佳一起学架构
 * @Description：取最快转换类
 */
public class ApplyToEither {
    public static void main(String[] args) {
        String result = CompletableFuture.supplyAsync(() -> {
            SleepTools.second(1);
            return "s1";
        }).applyToEither(CompletableFuture.supplyAsync(() -> {
            SleepTools.second(2);
            return "hello world";
        }), s -> s).join();
        System.out.println(result);
    }
}
